package com.kangye.enterprise.frontdesk.service.impl;

import com.kangye.enterprise.frontdesk.entity.Department;
import com.kangye.enterprise.frontdesk.entity.Item;
import com.kangye.enterprise.frontdesk.mapper.DepartmentMapper;
import com.kangye.enterprise.frontdesk.service.DepartmentService;
import com.kangye.enterprise.frontdesk.util.ViewJsonObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @program: enterprise
 * @description:部门逻辑接口实现类
 * @author: 索腾龙
 * @create: 2021-05-31 13:54
 **/
@Service
@Transactional
public class DepartmentServiceImpl implements DepartmentService {
    @Autowired
    private DepartmentMapper departmentMapper;
    //政策即时推送(未关注)  全部部门列表(索腾龙写)
    @Override
    public ViewJsonObject<Department> selDepartment() {
        List<Department> list = departmentMapper.selDepartment();
        //判断list里是否有数据
        if (list.size()>0) {
            //返回json格式
            return new ViewJsonObject<Department>(list);
        } else {
            return new ViewJsonObject<>(1, "操作失败");
        }
    }
}